#include "transport.h"
#include "datalink.h"




extern "C" {


/*
 * 发送广播
 */
jstring Java_com_example_blinkhome_util_ndktool_sendudpbroadcast(JNIEnv *env,jobject obj,jstring ip)
{
	jstring res=scanfBlink(env,obj,ip,"B-Link");
	return res;
}

jstring Java_com_example_blinkhome_util_ndktool_sendudpip(JNIEnv *env,jobject obj,jstring ip,jstring message){

	jstring res=sendudp(env,obj,ip,message);
	return res;
}

jstring Java_com_example_blinkhome_util_ndktool_getBlinkRouteInfo(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonGetHostinfo();
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}




jstring Java_com_example_blinkhome_util_ndktool_getBlinklancfg(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateGetTerminallist();
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

jstring Java_com_example_blinkhome_util_ndktool_getBlinkGetlancfg(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateGetlancfg();
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设定IP设置信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkSetlancfg(JNIEnv *env,jobject obj,jstring ip,jstring mip,jstring mask,jstring dbcp,jstring startip,jstring endip){
	const char* cip=env->GetStringUTFChars(mip,NULL);
	const char* cmask=env->GetStringUTFChars(mask,NULL);
	const char* cdbcp=env->GetStringUTFChars(dbcp,NULL);
	const char* cstartip=env->GetStringUTFChars(startip,NULL);
	const char* cendip=env->GetStringUTFChars(endip,NULL);
	//生成Json
	char* jdata=jsonsetlancfg(cip,cmask,cdbcp,cstartip,cendip);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	env->ReleaseStringUTFChars(mip,cip);
	env->ReleaseStringUTFChars(mask,cmask);
	env->ReleaseStringUTFChars(dbcp,cdbcp);
	env->ReleaseStringUTFChars(startip,cstartip);
	env->ReleaseStringUTFChars(endip,cendip);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;
}

//获取上网设置信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetwancfg(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateGetlancfg();
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}



//获取无线开关
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetswitchwifi(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getswitchwifi");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//重启
jstring Java_com_example_blinkhome_util_ndktool_getBlinkreboot(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("reboot");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//复位
jstring Java_com_example_blinkhome_util_ndktool_getBlinkrestore(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("restore");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设置路由器别名
jstring Java_com_example_blinkhome_util_ndktool_getBlinksethostname(JNIEnv *env,jobject obj,jstring ip,jstring name){

	const char* cname=env->GetStringUTFChars(name,NULL);
	//生成Json
	char* jdata=jsonCreatesethostname(cname);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(name,cname);
	return res;

}



//设置访客信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetvisitorinfo(JNIEnv *env,jobject obj,jstring ip,int gassidable,jstring gssid,jstring gpsw){

	const char* id=env->GetStringUTFChars(gssid,NULL);
	const char* pw=env->GetStringUTFChars(gpsw,NULL);
	//生成Json
	char* jdata=jsonCreatesetvisitorinfo(id,pw,gassidable);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(gssid,id);
	env->ReleaseStringUTFChars(gssid,pw);
	return res;

}

//获取访客网络信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetvisitorinfo(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getvisitorinfo");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设置定点扫描
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetchannelon(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("setchannelon");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取信道信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetchannel(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getchannel");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取静态绑定
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetarpbindlist(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getarpbindlist");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//设置无线开关
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetswitchwifi(JNIEnv *env,jobject obj,jstring ip,int radioon){

	//生成Json
	char* jdata=jsonCreatesetswitchwifi(radioon);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设定信道
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetchannel(JNIEnv *env,jobject obj,jstring ip,int radioon){

	//生成Json
	char* jdata=jsonCreatesetswitchwifi(radioon);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设定信号强度
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetpamode(JNIEnv *env,jobject obj,jstring ip,int radioon){

	//生成Json
	char* jdata=jsonCreatesetswitchwifi(radioon);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//设定/解除黑名单
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetmacblack(JNIEnv *env,jobject obj,jstring ip,int radioon,jstring mac){

	const char* cmac=env->GetStringUTFChars(mac,NULL);
	//生成Json
	char* jdata=jsonCreatesetmacblack(cmac,radioon);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(mac,cmac);
	return res;

}

//获取终端列表
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetterminallist(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getterminallist");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取黑名单列表
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetblacklist(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getblacklist");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取路由器别名
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgethostname(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("gethostname");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取wan口连接模式（
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetwanmode(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getwanmode");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//宽带测速
jstring Java_com_example_blinkhome_util_ndktool_getBlinkbwcheck(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("bwcheck");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取宽带信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetbwinfo(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getbwinfo");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取信号强度
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetpamode(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getpamode");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取固件版本
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetfirmver(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getfirmver");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//获取路由器信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetrouterinfo(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getrouterinfo");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获取WAN口信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetwaninfo(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getwaninfo");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//获取QOS
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetQos(JNIEnv *env,jobject obj,jstring ip,jstring mac){

	const char* cmac=env->GetStringUTFChars(mac,NULL);
	//生成Json
	char* jdata=jsonCreateGetQos(cmac);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(mac,cmac);
	return res;

}

//设定Qos模式
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetqos(JNIEnv *env,jobject obj,jstring ip,jstring mac,jstring deviceip,jstring Upspeed,jstring downspeed){

	const char* cmac=env->GetStringUTFChars(mac,NULL);
	const char* cdeviceip=env->GetStringUTFChars(deviceip,NULL);
	const char* cupspeed=env->GetStringUTFChars(Upspeed,NULL);
	const char* cdownspeed=env->GetStringUTFChars(downspeed,NULL);
	//生成Json
	char* jdata=jsonCreatesetqos(cmac,cdeviceip,cupspeed,cdownspeed);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(mac,cmac);
	env->ReleaseStringUTFChars(deviceip,cdeviceip);
	env->ReleaseStringUTFChars(Upspeed,cupspeed);
	env->ReleaseStringUTFChars(downspeed,cdownspeed);
	return res;

}


//固件升级
jstring Java_com_example_blinkhome_util_ndktool_getBlinkupgrade(JNIEnv *env,jobject obj,jstring ip,int isforce,jstring url){

	const char* curl=env->GetStringUTFChars(url,NULL);
	//生成Json
	char* jdata=jsonCreateupgrade(isforce,curl);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(url,curl);
	return res;

}


//优化信道
jstring Java_com_example_blinkhome_util_ndktool_getBlinkrefinechannel(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("refinechannel");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//获得管理员密码
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetmanpwd(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreateCFG("getmanpwd");
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}


//设置管理员密码
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetmanpwd(JNIEnv *env,jobject obj,jstring ip,jstring routepwd){

	const char* croutepw=env->GetStringUTFChars(routepwd,NULL);

	//生成Json
	char* jdata=jsonCreatesetmanpwd(croutepw);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(routepwd,croutepw);
	return res;

}



//获取无线设置信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkgetwlancfg(JNIEnv *env,jobject obj,jstring ip){

	//生成Json
	char* jdata=jsonCreategetwancfg();
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;

}

//设置终端静态绑定
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetarpbind(JNIEnv *env,jobject obj,jstring ip,jstring mac,jstring deviceip,int i){

	const char* cmac=env->GetStringUTFChars(mac,NULL);
	const char* cdevice=env->GetStringUTFChars(deviceip,NULL);

	//生成Json
	char* jdata=jsonsetarpbind(cmac,cdevice,i);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(mac,cmac);
	env->ReleaseStringUTFChars(deviceip,cdevice);
	return res;

}

//设定无线设置信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinksetwlancfg(JNIEnv *env,jobject obj,jstring ip,jstring wlanssid,jstring wlanpsw,jstring wlanpswmode,jstring wlanpswencry){

	const char* cwlanssid=env->GetStringUTFChars(wlanssid,NULL);
	const char* cwlanpsw=env->GetStringUTFChars(wlanpsw,NULL);
	const char* cwlanpswmode=env->GetStringUTFChars(wlanpswmode,NULL);
	const char* cwlanpswencry=env->GetStringUTFChars(wlanpswencry,NULL);

	//生成Json
	char* jdata=jsonsetwlancfg(cwlanssid,cwlanpsw,cwlanpswmode,cwlanpswencry);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	env->ReleaseStringUTFChars(wlanpsw,cwlanpsw);
	env->ReleaseStringUTFChars(wlanpswencry,cwlanpswencry);
	env->ReleaseStringUTFChars(wlanpswmode,cwlanpswmode);
	env->ReleaseStringUTFChars(wlanssid,cwlanssid);
	return res;

}

//设定上网设置信息
jstring Java_com_example_blinkhome_util_ndktool_getBlinkSetwancfg(JNIEnv *env,jobject obj,jstring ip,jstring wanmode,jstring wanip,jstring wanmask,jstring wangw,jstring dns1,jstring dns2){
	const char* cwanmode=env->GetStringUTFChars(wanmode,NULL);
	const char* cwanip=env->GetStringUTFChars(wanip,NULL);
	const char* cdbcp=env->GetStringUTFChars(wanmask,NULL);
	const char* cwangw=env->GetStringUTFChars(wangw,NULL);
	const char* cdns1=env->GetStringUTFChars(dns1,NULL);
	const char* cdns2=env->GetStringUTFChars(dns2,NULL);
	//生成Json
	char* jdata=jsonSetWancfg(cwanmode,cwanip,cdbcp,cwangw,cdns1,cdns2);
	LOGI("生成JSON完毕==%s",jdata);
	//生成sendstring
	char* sdata=dataCreateSendString(jdata);
	LOGI("sendstring==%s",sdata);
	jstring res=sendudpchar(env,obj,ip,sdata);
	env->ReleaseStringUTFChars(wanmode,cwanmode);
	env->ReleaseStringUTFChars(wanip,cwanip);
	env->ReleaseStringUTFChars(wanmask,cdbcp);
	env->ReleaseStringUTFChars(wangw,cwangw);
	env->ReleaseStringUTFChars(dns1,cdns1);
	env->ReleaseStringUTFChars(dns1,cdns2);
	if(jdata!=NULL)
		delete[] jdata;
	if(sdata!=NULL)
		delete[] sdata;
	if(sdata!=NULL)
		delete[] sdata;
	return res;
}
}
